<?php
class Core_Model_Website_Sef extends Dcmp_Model_Entity{

    public function __construct(){
        parent::__construct();
    }
    
    protected function getTableClass(){
    	return Kd_Loader::loadClass('table_website_sef');
    }

    protected function initializeTable($table){
        $table->setName('{t}website_sef');
        $table->createColumn('id', 'integer', TRUE, TRUE);
        $table->createColumn('rewrite_url', 'string');
        $table->createColumn('source_id', 'integer');
        $table->createColumn('source_url', 'string');
        $table->createColumn('source_type', 'string');
    }
    
    public function loadBySourceId($type, $id){
    	$row = $this->getTable()->getBySourceId($id, $type);
    	return $this->fill($row)->markNoChanged();
    }

    public function loadBySourceUrl($type, $url){
        $row = $this->getTable()->getBySourceUrl($type, $url);
        return $this->fill($row)->markNoChanged();
    }  
}